package com.audaque.springboot.foshanupload.session.config;


import com.audaque.springboot.foshanupload.authcore.properties.LoginProperties;
import com.audaque.springboot.foshanupload.authcore.properties.SessionJwtOrderProperties;
import com.audaque.springboot.foshanupload.session.interceptor.SessionLoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class RedisHttpSessionInterceptorConfig implements WebMvcConfigurer {
    @Autowired
    public SessionLoginInterceptor sessionLoginInterceptor;
    @Autowired
    private LoginProperties loginProperties;
    @Autowired
    private SessionJwtOrderProperties sessionJwtOrderProperties;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(sessionLoginInterceptor).addPathPatterns(loginProperties.getLoginUrl()).order(sessionJwtOrderProperties.getSessionLoginInterceptor());
    }


}
